home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
spoc88.zip
/
TBTASM.ZIP
/
TBQPA.ASM
< prev
Wrap
Assembly Source File
|
1988-06-14
|
2KB
|
49 lines
;TBQPA.ASM Fast screen write routine for Turbo Basic
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
PUSH BP ;Save BP
MOV BP,SP ;Get stack address
;Get arguments
LES BX,[BP+0AH] ;Get addr of Col variable
MOV DI,ES:[BX] ;Put Col number in DI
DEC DI ;Change Col # to 0 - 79
LES BX,[BP+0EH] ;Get addr of Row variable
MOV AX,ES:[BX] ;Put Row # in AX
DEC AX ;Change to 0 - 25
LES BX,[BP+12H] ;Get addr of string pointer
MOV CX,ES:[BX] ;Put string length in CL
AND CX,7FFFH ;Remove high bit
CMP CX,00 ;Is it zero?
JZ QUIT ;Yes, quit
MOV SI,ES:[BX+02] ;Put string start addr in SI
;Compute offset into video buffer
MOV DX,0050H ;Num of char per row
MUL DX ;# rows times 80
ADD DI,AX ;Add column number
SHL DI,1 ;Multiply by 2
;Get video parameters
LES BX,[BP+06] ;Get address of attribute
MOV BX,ES:[BX] ;Put attribute in BX
MOV AX,0B000H ;Video buffer addr, mono
MOV ES,AX ;Put it in ES
MOV AH,0FH ;Read video mode
INT 10H
CMP AL,7 ;Is it mono?
JE A
MOV AX,0B800H ;Video buffer addr, mono
MOV ES,AX ;Put it in ES
A: PUSH DS ;Save DS on stack
;Copy data to video buffer
MOV DS,DS:[00] ;Get string segment
CLD ;Clear direction flag
B: MOVSB ;Send 1 byte to buffer
MOV BYTE PTR ES:[DI],BL ;Attribute byte
INC DI ;Skip attribute byte
LOOP B ;Loop until done
;Clean up and leave
POP DS ;Restore DS
QUIT: POP BP ;Restore BP
CODE ENDS ;TB runtime handles return
END